package androidx.viewpager.widget;

import android.content.Context;
import android.content.res.TypedArray;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
import android.view.FocusFinder;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.SoundEffectConstants;
import android.view.VelocityTracker;
import android.view.View;
import android.view.ViewConfiguration;
import android.view.ViewGroup;
import android.view.ViewParent;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.Interpolator;
import android.widget.EdgeEffect;
import android.widget.Scroller;
import androidx.annotation.CallSuper;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.core.view.ViewCompat;
import androidx.customview.view.AbsSavedState;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import o.fo;
import o.PagerAdapter;

public class ViewPager extends ViewGroup {
    private static final Interpolator sInterpolator = new Interpolator() {
        public float getInterpolation(float f) {
            float f2 = f - 1.0f;
            return (f2 * (((f2 * f2) * f2) * f2)) + 1.0f;
        }
    };
    private static final Comparator<ItemInfo> COMPARATOR = new Comparator<ItemInfo>() {
        public /* synthetic */ int compare(Object obj, Object obj2) {
            return ˏ((ItemInfo) obj, (ItemInfo) obj2);
        }

        public int ˏ(ItemInfo cVar, ItemInfo cVar2) {
            return cVar.position - cVar2.position;
        }
    };
    static final int[] ˏ = new int[]{16842931};
    private static final i sPositionComparator = new i();
    private int mScrollState = 0;
    private final ItemInfo ʻ = new ItemInfo();
    private int ʻॱ;
    private boolean ʼॱ;
    private final ArrayList<ItemInfo> mItems = new ArrayList();
    private boolean ʽॱ;
    private float ʾ = Float.MAX_VALUE;
    private int ʿ;
    private int ˈ;
    private int mDefaultGutterSize;
    private int mOffscreenPageLimit = 1;
    private boolean mPopulatePending;
    private ClassLoader mRestoredClassLoader = null;
    private boolean ˊᐝ;
    private int mExpectedAdapterCount;
    private boolean ˋˊ;
    private float ˋˋ;
    private g mObserver;
    private int ˋᐝ;
    private float ˌ;
    private float ˍ;
    PagerAdapter mAdapter;
    private int ˎˎ;
    private int ˎˏ = -1;
    private int ˏˎ;
    private VelocityTracker ˏˏ;
    public Scroller mScroller;
    private float ˑ;
    private boolean ͺ;
    private int ͺॱ;
    private boolean ـ;
    int mCurItem;
    private EdgeEffect mLeftEdge;
    private int mCloseEnough;
    private int mFlingDistance;
    private Parcelable mRestoredAdapterState = null;
    private int ॱˋ;
    private float ॱˎ = -3.4028235E38f;
    private EdgeEffect mRightEdge;
    private final Rect ॱॱ = new Rect();
    private int ॱᐝ;
    private int mRestoredCurItem = -1;
    private boolean ᐝˊ;
    private int ᐝˋ;
    private Drawable ᐝॱ;
    private boolean ᐝᐝ = false;
    private boolean mFirstLayout = true;
    private List<OnPageChangeListener> mOnPageChangeListeners;
    private OnPageChangeListener ᶥ;
    private OnPageChangeListener ㆍ;
    private List<d> mAdapterChangeListeners;
    private int ꜞ;
    private e mPageTransformer;
    private int ﹳ;
    private ArrayList<View> mDrawingOrderedChildren;
    private final Runnable mEndScrollRunnable = new 5(this);

    @Inherited
    @Target({ElementType.TYPE})
    @Retention(RetentionPolicy.RUNTIME)
    public @interface DecorView {
    }

    public static class LayoutParams extends android.view.ViewGroup.LayoutParams {
        int ʼ;
        int ˊ;
        float ˋ = 0.0f;
        public boolean ˎ;
        public int ˏ;
        boolean ॱ;

        public LayoutParams() {
            super(-1, -1);
        }

        public LayoutParams(Context context, AttributeSet attributeSet) {
            super(context, attributeSet);
            TypedArray obtainStyledAttributes = context.obtainStyledAttributes(attributeSet, ViewPager.ˏ);
            this.ˏ = obtainStyledAttributes.getInteger(0, 48);
            obtainStyledAttributes.recycle();
        }
    }

    public static class SavedState extends AbsSavedState {
        public static final Creator<SavedState> CREATOR = new ClassLoaderCreator<SavedState>() {
            public /* synthetic */ Object createFromParcel(Parcel parcel) {
                return ॱ(parcel);
            }

            public /* synthetic */ Object createFromParcel(Parcel parcel, ClassLoader classLoader) {
                return ˎ(parcel, classLoader);
            }

            public /* synthetic */ Object[] newArray(int i) {
                return ˋ(i);
            }

            public SavedState ˎ(Parcel parcel, ClassLoader classLoader) {
                return new SavedState(parcel, classLoader);
            }

            public SavedState ॱ(Parcel parcel) {
                return new SavedState(parcel, null);
            }

            public SavedState[] ˋ(int i) {
                return new SavedState[i];
            }
        };
        Parcelable ˋ;
        ClassLoader ˎ;
        int ॱ;

        public SavedState(@NonNull Parcelable parcelable) {
            super(parcelable);
        }

        public void writeToParcel(Parcel parcel, int i) {
            super.writeToParcel(parcel, i);
            parcel.writeInt(this.ॱ);
            parcel.writeParcelable(this.ˋ, i);
        }

        public String toString() {
            return "FragmentPager.SavedState{" + Integer.toHexString(System.identityHashCode(this)) + " position=" + this.ॱ + "}";
        }

        SavedState(Parcel parcel, ClassLoader classLoader) {
            super(parcel, classLoader);
            if (classLoader == null) {
                classLoader = getClass().getClassLoader();
            }
            this.ॱ = parcel.readInt();
            this.ˋ = parcel.readParcelable(classLoader);
            this.ˎ = classLoader;
        }
    }

    public interface OnPageChangeListener {
        void onPageScrollStateChanged(int state);

        void onPageScrolled(int i);

        void onPageScrolled(int postion, float positionOffset, @Px int positionOffsetPixels);
    }

    static class ItemInfo {
        float ˊ;
        Object object;
        int position;
        boolean scrolling;
        float ॱ;

        ItemInfo() {
        }
    }

    public interface d {
        void onAdapterChanged(@NonNull ViewPager viewPager, @Nullable PagerAdapter ozVar, @Nullable PagerAdapter ozVar2);
    }

    public interface e {
        void ˊ(@NonNull View view, float f);
    }

    class g extends DataSetObserver {
        final /* synthetic */ ViewPager ˏ;

        g(ViewPager viewPager) {
            this.ˏ = viewPager;
        }

        public void onChanged() {
            this.ˏ.ˊ();
        }

        public void onInvalidated() {
            this.ˏ.ˊ();
        }
    }

    static class i implements Comparator<View> {
        i() {
        }

        public /* synthetic */ int compare(Object obj, Object obj2) {
            return ˏ((View) obj, (View) obj2);
        }

        public int ˏ(View view, View view2) {
            LayoutParams layoutParams = (LayoutParams) view.getLayoutParams();
            LayoutParams layoutParams2 = (LayoutParams) view2.getLayoutParams();
            if (layoutParams.ˎ != layoutParams2.ˎ) {
                return layoutParams.ˎ ? 1 : -1;
            } else {
                return layoutParams.ˊ - layoutParams2.ˊ;
            }
        }
    }

    public ViewPager(@NonNull Context context) {
        super(context);
        ॱ();
    }

    public ViewPager(@NonNull Context context, @Nullable AttributeSet attributeSet) {
        super(context, attributeSet);
        ॱ();
    }

    void ॱ() {
        setWillNotDraw(false);
        setDescendantFocusability(262144);
        setFocusable(true);
        Context context = getContext();
        this.mScroller = new Scroller(context, sInterpolator);
        ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
        float f = context.getResources().getDisplayMetrics().density;
        this.ˋᐝ = viewConfiguration.getScaledPagingTouchSlop();
        this.ͺॱ = (int) (400.0f * f);
        this.ˏˎ = viewConfiguration.getScaledMaximumFlingVelocity();
        this.mLeftEdge = new EdgeEffect(context);
        this.mRightEdge = new EdgeEffect(context);
        this.mFlingDistance = (int) (25.0f * f);
        this.mCloseEnough = (int) (2.0f * f);
        this.mDefaultGutterSize = (int) (16.0f * f);
        ViewCompat.ˏ((View) this, new b(this));
        if (ViewCompat.getImportantForAccessibility(this) == 0) {
            ViewCompat.setImportantForAccessibility((View) this, 1);
        }
        ViewCompat.ˋ((View) this, new 3(this));
    }

    protected void onDetachedFromWindow() {
        removeCallbacks(this.mEndScrollRunnable);
        if (!(this.mScroller == null || this.mScroller.isFinished())) {
            this.mScroller.abortAnimation();
        }
        super.onDetachedFromWindow();
    }

    void setScrollState(int newState) {
        if (this.mScrollState != newState) {
            this.mScrollState = newState;
            if (this.mPageTransformer != null) {
                enableLayers(newState != 0);
            }
            dispatchOnScrollStateChanged(newState);
        }
    }

    public void setAdapter(@Nullable PagerAdapter ozVar) {
        int i = false;
        if (this.mAdapter != null) {
            this.mAdapter.setViewPagerObserver(null);
            this.mAdapter.startUpdate((ViewGroup) this);
            for (int i2 = 0; i2 < this.mItems.size(); i2++) {
                ItemInfo cVar = (ItemInfo) this.mItems.get(i2);
                this.mAdapter.destroyItem(this, cVar.position, cVar.object);
            }
            this.mAdapter.finishUpdate((ViewGroup) this);
            this.mItems.clear();
            removeNonDecorViews();
            this.mCurItem = 0;
            scrollTo(0, 0);
        }
        PagerAdapter ozVar2 = this.mAdapter;
        this.mAdapter = ozVar;
        this.mExpectedAdapterCount = 0;
        if (this.mAdapter != null) {
            if (this.mObserver == null) {
                this.mObserver = new g(this);
            }
            this.mAdapter.setViewPagerObserver(this.mObserver);
            this.mPopulatePending = false;
            boolean wasFirstLayout = this.mFirstLayout;
            this.mFirstLayout = true;
            this.mExpectedAdapterCount = this.mAdapter.getCount();
            if (this.mRestoredCurItem >= 0) {
                this.mAdapter.restoreState(this.mRestoredAdapterState, this.mRestoredClassLoader);
                setCurrentItemInternal(this.mRestoredCurItem, false, true);
                this.mRestoredCurItem = -1;
                this.mRestoredAdapterState = null;
                this.mRestoredClassLoader = null;
            } else if (wasFirstLayout) {
                requestLayout();
            } else {
                populate();
            }
        }
        if (this.mAdapterChangeListeners != null && !this.mAdapterChangeListeners.isEmpty()) {
            int size = this.mAdapterChangeListeners.size();
            while (i < size) {
                ((d) this.mAdapterChangeListeners.get(i)).onAdapterChanged(this, ozVar2, ozVar);
                i++;
            }
        }
    }

    private void removeNonDecorViews() {
        int i = 0;
        while (i < getChildCount()) {
            if (!((LayoutParams) getChildAt(i).getLayoutParams()).ˎ) {
                removeViewAt(i);
                i--;
            }
            i++;
        }
    }

    @Nullable
    public PagerAdapter getAdapter() {
        return this.mAdapter;
    }

    public void addOnAdapterChangeListener(@NonNull d dVar) {
        if (this.mAdapterChangeListeners == null) {
            this.mAdapterChangeListeners = new ArrayList();
        }
        this.mAdapterChangeListeners.add(dVar);
    }

    public void removeOnAdapterChangeListener(@NonNull d dVar) {
        if (this.mAdapterChangeListeners != null) {
            this.mAdapterChangeListeners.remove(dVar);
        }
    }

    private int getClientWidth() {
        return (getMeasuredWidth() - getPaddingLeft()) - getPaddingRight();
    }

    public void setCurrentItem(int i) {
        boolean z;
        this.mPopulatePending = false;
        if (this.mFirstLayout) {
            z = false;
        } else {
            z = true;
        }
        setCurrentItemInternal(i, z, false);
    }

    public void setCurrentItem(int item, boolean smoothScroll) {
        this.mPopulatePending = false;
        setCurrentItemInternal(item, smoothScroll, false);
    }

    public int getCurrentItem() {
        return this.mCurItem;
    }

    void setCurrentItemInternal(int item, boolean smoothScroll, boolean always) {
        setCurrentItemInternal(item, smoothScroll, always, 0);
    }

    void setCurrentItemInternal(int item, boolean smoothScroll, boolean always, int velocity) {
        boolean z3 = false;
        if (this.mAdapter == null || this.mAdapter.getCount() <= 0) {
            setScrollingCacheEnabled(false);
        } else if (always || this.mCurItem != item || this.mItems.size() == 0) {
            if (item < 0) {
                item = 0;
            } else if (item >= this.mAdapter.getCount()) {
                item = this.mAdapter.getCount() - 1;
            }
            int i3 = this.mOffscreenPageLimit;
            if (item > this.mCurItem + i3 || item < this.mCurItem - i3) {
                for (int i4 = 0; i4 < this.mItems.size(); i4++) {
                    ((ItemInfo) this.mItems.get(i4)).scrolling = true;
                }
            }
            if (this.mCurItem != item) {
                z3 = true;
            }
            if (this.mFirstLayout) {
                this.mCurItem = item;
                if (z3) {
                    ॱॱ(item);
                }
                requestLayout();
                return;
            }
            ˏ(item);
            ˎ(item, smoothScroll, velocity, z3);
        } else {
            setScrollingCacheEnabled(false);
        }
    }

    private void ˎ(int i, boolean z, int i2, boolean z2) {
        int max;
        ItemInfo ˋ = ˋ(i);
        if (ˋ != null) {
            max = (int) (Math.max(this.ॱˎ, Math.min(ˋ.ॱ, this.ʾ)) * ((float) getClientWidth()));
        } else {
            max = 0;
        }
        if (z) {
            ˋ(max, 0, i2);
            if (z2) {
                ॱॱ(i);
                return;
            }
            return;
        }
        if (z2) {
            ॱॱ(i);
        }
        ˋ(false);
        scrollTo(max, 0);
        ॱ(max);
    }

    @Deprecated
    public void setOnPageChangeListener(OnPageChangeListener aVar) {
        this.ᶥ = aVar;
    }

    public void addOnPageChangeListener(@NonNull OnPageChangeListener aVar) {
        if (this.mOnPageChangeListeners == null) {
            this.mOnPageChangeListeners = new ArrayList();
        }
        this.mOnPageChangeListeners.add(aVar);
    }

    public void removeOnPageChangeListener(@NonNull OnPageChangeListener aVar) {
        if (this.mOnPageChangeListeners != null) {
            this.mOnPageChangeListeners.remove(aVar);
        }
    }

    public void setPageTransformer(boolean z, @Nullable e eVar) {
        setPageTransformer(z, eVar, 2);
    }

    public void setPageTransformer(boolean z, @Nullable e eVar, int i) {
        boolean z2;
        int i2 = 1;
        boolean z3 = eVar != null;
        if (this.mPageTransformer != null) {
            z2 = true;
        } else {
            z2 = false;
        }
        int i3 = z3 != z2 ? 1 : 0;
        this.mPageTransformer = eVar;
        setChildrenDrawingOrderEnabled(z3);
        if (z3) {
            if (z) {
                i2 = 2;
            }
            this.ﹳ = i2;
            this.ꜞ = i;
        } else {
            this.ﹳ = 0;
        }
        if (i3 != 0) {
            populate();
        }
    }

    protected int getChildDrawingOrder(int i, int i2) {
        if (this.ﹳ == 2) {
            i2 = (i - 1) - i2;
        }
        return ((LayoutParams) ((View) this.mDrawingOrderedChildren.get(i2)).getLayoutParams()).ʼ;
    }

    OnPageChangeListener ˏ(OnPageChangeListener aVar) {
        OnPageChangeListener aVar2 = this.ㆍ;
        this.ㆍ = aVar;
        return aVar2;
    }

    public void setOffscreenPageLimit(int i) {
        if (i < 1) {
            Log.w("ViewPager", "Requested offscreen page limit " + i + " too small; defaulting to " + 1);
            i = 1;
        }
        if (i != this.mOffscreenPageLimit) {
            this.mOffscreenPageLimit = i;
            populate();
        }
    }

    public void setPageMargin(int i) {
        int i2 = this.ʻॱ;
        this.ʻॱ = i;
        int width = getWidth();
        ˊ(width, width, i, i2);
        requestLayout();
    }

    public void setPageMarginDrawable(@Nullable Drawable drawable) {
        this.ᐝॱ = drawable;
        if (drawable != null) {
            refreshDrawableState();
        }
        setWillNotDraw(drawable == null);
        invalidate();
    }

    public void setPageMarginDrawable(@DrawableRes int i) {
        setPageMarginDrawable(fo.ˊ(getContext(), i));
    }

    protected boolean verifyDrawable(Drawable drawable) {
        return super.verifyDrawable(drawable) || drawable == this.ᐝॱ;
    }

    protected void drawableStateChanged() {
        super.drawableStateChanged();
        Drawable drawable = this.ᐝॱ;
        if (drawable != null && drawable.isStateful()) {
            drawable.setState(getDrawableState());
        }
    }

    float ˎ(float f) {
        return (float) Math.sin((double) ((f - 0.5f) * 0.47123894f));
    }

    void ˋ(int i, int i2, int i3) {
        if (getChildCount() == 0) {
            setScrollingCacheEnabled(false);
            return;
        }
        int i4;
        boolean z = (this.mScroller == null || this.mScroller.isFinished()) ? false : true;
        if (z) {
            int currX = this.ͺ ? this.mScroller.getCurrX() : this.mScroller.getStartX();
            this.mScroller.abortAnimation();
            setScrollingCacheEnabled(false);
            i4 = currX;
        } else {
            i4 = getScrollX();
        }
        int scrollY = getScrollY();
        int i5 = i - i4;
        int i6 = i2 - scrollY;
        if (i5 == 0 && i6 == 0) {
            ˋ(false);
            populate();
            setScrollState(0);
            return;
        }
        setScrollingCacheEnabled(true);
        setScrollState(2);
        currX = getClientWidth();
        int i7 = currX / 2;
        float ˎ = (((float) i7) * ˎ(Math.min(1.0f, (((float) Math.abs(i5)) * 1.0f) / ((float) currX)))) + ((float) i7);
        int abs = Math.abs(i3);
        if (abs > 0) {
            currX = Math.round(1000.0f * Math.abs(ˎ / ((float) abs))) * 4;
        } else {
            currX = (int) (((((float) Math.abs(i5)) / ((((float) currX) * this.mAdapter.getPageWidth(this.mCurItem)) + ((float) this.ʻॱ))) + 1.0f) * 100.0f);
        }
        i7 = Math.min(currX, 600);
        this.ͺ = false;
        this.mScroller.startScroll(i4, scrollY, i5, i6, i7);
        ViewCompat.ˎ(this);
    }

    ItemInfo ˊ(int i, int i2) {
        ItemInfo cVar = new ItemInfo();
        cVar.position = i;
        cVar.object = this.mAdapter.instantiateItem((ViewGroup) this, i);
        cVar.ˊ = this.mAdapter.getPageWidth(i);
        if (i2 < 0 || i2 >= this.mItems.size()) {
            this.mItems.add(cVar);
        } else {
            this.mItems.add(i2, cVar);
        }
        return cVar;
    }

    void ˊ() {
        boolean z;
        int ˎ = this.mAdapter.getCount();
        this.mExpectedAdapterCount = ˎ;
        if (this.mItems.size() >= (this.mOffscreenPageLimit * 2) + 1 || this.mItems.size() >= ˎ) {
            z = false;
        } else {
            z = true;
        }
        boolean z2 = false;
        int i = this.mCurItem;
        boolean z3 = z;
        int i2 = 0;
        while (i2 < this.mItems.size()) {
            int i3;
            boolean z4;
            int i4;
            boolean z5;
            ItemInfo cVar = (ItemInfo) this.mItems.get(i2);
            int ˏ = this.mAdapter.getItemPosition(cVar.object);
            if (ˏ == -1) {
                i3 = i2;
                z4 = z2;
                i4 = i;
                z5 = z3;
            } else if (ˏ == -2) {
                this.mItems.remove(i2);
                i2--;
                if (!z2) {
                    this.mAdapter.startUpdate((ViewGroup) this);
                    z2 = true;
                }
                this.mAdapter.destroyItem(this, cVar.position, cVar.object);
                if (this.mCurItem == cVar.position) {
                    i3 = i2;
                    z4 = z2;
                    i4 = Math.max(0, Math.min(this.mCurItem, ˎ - 1));
                    z5 = true;
                } else {
                    i3 = i2;
                    z4 = z2;
                    i4 = i;
                    z5 = true;
                }
            } else if (cVar.position != ˏ) {
                if (cVar.position == this.mCurItem) {
                    i = ˏ;
                }
                cVar.position = ˏ;
                i3 = i2;
                z4 = z2;
                i4 = i;
                z5 = true;
            } else {
                i3 = i2;
                z4 = z2;
                i4 = i;
                z5 = z3;
            }
            z3 = z5;
            i = i4;
            z2 = z4;
            i2 = i3 + 1;
        }
        if (z2) {
            this.mAdapter.finishUpdate((ViewGroup) this);
        }
        Collections.sort(this.mItems, COMPARATOR);
        if (z3) {
            i4 = getChildCount();
            for (i2 = 0; i2 < i4; i2++) {
                LayoutParams layoutParams = (LayoutParams) getChildAt(i2).getLayoutParams();
                if (!layoutParams.ˎ) {
                    layoutParams.ˋ = 0.0f;
                }
            }
            setCurrentItemInternal(i, false, true);
            requestLayout();
        }
    }

    void populate() {
        ˏ(this.mCurItem);
    }

    /* JADX WARNING: inconsistent code. */
    /* Code decompiled incorrectly, please refer to instructions dump. */
    void ˏ(int r18) {
        /*
        r17 = this;
        r2 = 0;
        r0 = r17;
        r3 = r0.ॱ;
        r0 = r18;
        if (r3 == r0) goto L_0x031e;
    L_0x0009:
        r0 = r17;
        r2 = r0.ॱ;
        r0 = r17;
        r2 = r0.ˋ(r2);
        r0 = r18;
        r1 = r17;
        r1.ॱ = r0;
        r3 = r2;
    L_0x001a:
        r0 = r17;
        r2 = r0.ˎ;
        if (r2 != 0) goto L_0x0024;
    L_0x0020:
        r17.ʼ();
    L_0x0023:
        return;
    L_0x0024:
        r0 = r17;
        r2 = r0.ˊˋ;
        if (r2 == 0) goto L_0x002e;
    L_0x002a:
        r17.ʼ();
        goto L_0x0023;
    L_0x002e:
        r2 = r17.getWindowToken();
        if (r2 == 0) goto L_0x0023;
    L_0x0034:
        r0 = r17;
        r2 = r0.ˎ;
        r0 = r17;
        r2.ॱ(r0);
        r0 = r17;
        r2 = r0.ˊˊ;
        r4 = 0;
        r0 = r17;
        r5 = r0.ॱ;
        r5 = r5 - r2;
        r10 = java.lang.Math.max(r4, r5);
        r0 = r17;
        r4 = r0.ˎ;
        r11 = r4.ˎ();
        r4 = r11 + -1;
        r0 = r17;
        r5 = r0.ॱ;
        r2 = r2 + r5;
        r12 = java.lang.Math.min(r4, r2);
        r0 = r17;
        r2 = r0.ˋ;
        if (r11 == r2) goto L_0x00cb;
    L_0x0064:
        r2 = r17.getResources();	 Catch:{ NotFoundException -> 0x00c1 }
        r3 = r17.getId();	 Catch:{ NotFoundException -> 0x00c1 }
        r2 = r2.getResourceName(r3);	 Catch:{ NotFoundException -> 0x00c1 }
    L_0x0070:
        r3 = new java.lang.IllegalStateException;
        r4 = new java.lang.StringBuilder;
        r4.<init>();
        r5 = "The application's PagerAdapter changed the adapter's contents without calling PagerAdapter#notifyDataSetChanged! Expected adapter item count: ";
        r4 = r4.append(r5);
        r0 = r17;
        r5 = r0.ˋ;
        r4 = r4.append(r5);
        r5 = ", found: ";
        r4 = r4.append(r5);
        r4 = r4.append(r11);
        r5 = " Pager id: ";
        r4 = r4.append(r5);
        r2 = r4.append(r2);
        r4 = " Pager class: ";
        r2 = r2.append(r4);
        r4 = r17.getClass();
        r2 = r2.append(r4);
        r4 = " Problematic adapter: ";
        r2 = r2.append(r4);
        r0 = r17;
        r4 = r0.ˎ;
        r4 = r4.getClass();
        r2 = r2.append(r4);
        r2 = r2.toString();
        r3.<init>(r2);
        throw r3;
    L_0x00c1:
        r2 = move-exception;
        r2 = r17.getId();
        r2 = java.lang.Integer.toHexString(r2);
        goto L_0x0070;
    L_0x00cb:
        r5 = 0;
        r2 = 0;
        r4 = r2;
    L_0x00ce:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.size();
        if (r4 >= r2) goto L_0x031b;
    L_0x00d8:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r4);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
        r6 = r2.ˎ;
        r0 = r17;
        r7 = r0.ॱ;
        if (r6 < r7) goto L_0x01ba;
    L_0x00ea:
        r6 = r2.ˎ;
        r0 = r17;
        r7 = r0.ॱ;
        if (r6 != r7) goto L_0x031b;
    L_0x00f2:
        if (r2 != 0) goto L_0x0318;
    L_0x00f4:
        if (r11 <= 0) goto L_0x0318;
    L_0x00f6:
        r0 = r17;
        r2 = r0.ॱ;
        r0 = r17;
        r2 = r0.ˊ(r2, r4);
        r9 = r2;
    L_0x0101:
        if (r9 == 0) goto L_0x017c;
    L_0x0103:
        r8 = 0;
        r7 = r4 + -1;
        if (r7 < 0) goto L_0x01bf;
    L_0x0108:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r7);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
    L_0x0112:
        r13 = r17.ᐝ();
        if (r13 > 0) goto L_0x01c2;
    L_0x0118:
        r5 = 0;
    L_0x0119:
        r0 = r17;
        r6 = r0.ॱ;
        r6 = r6 + -1;
        r15 = r6;
        r6 = r8;
        r8 = r15;
        r16 = r7;
        r7 = r4;
        r4 = r16;
    L_0x0127:
        if (r8 < 0) goto L_0x0131;
    L_0x0129:
        r14 = (r6 > r5 ? 1 : (r6 == r5 ? 0 : -1));
        if (r14 < 0) goto L_0x0201;
    L_0x012d:
        if (r8 >= r10) goto L_0x0201;
    L_0x012f:
        if (r2 != 0) goto L_0x01d1;
    L_0x0131:
        r5 = r9.ˊ;
        r8 = r7 + 1;
        r2 = 1073741824; // 0x40000000 float:2.0 double:5.304989477E-315;
        r2 = (r5 > r2 ? 1 : (r5 == r2 ? 0 : -1));
        if (r2 >= 0) goto L_0x0168;
    L_0x013b:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.size();
        if (r8 >= r2) goto L_0x0237;
    L_0x0145:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r8);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
        r6 = r2;
    L_0x0150:
        if (r13 > 0) goto L_0x023a;
    L_0x0152:
        r2 = 0;
        r4 = r2;
    L_0x0154:
        r0 = r17;
        r2 = r0.ॱ;
        r2 = r2 + 1;
        r15 = r2;
        r2 = r6;
        r6 = r8;
        r8 = r15;
    L_0x015e:
        if (r8 >= r11) goto L_0x0168;
    L_0x0160:
        r10 = (r5 > r4 ? 1 : (r5 == r4 ? 0 : -1));
        if (r10 < 0) goto L_0x0281;
    L_0x0164:
        if (r8 <= r12) goto L_0x0281;
    L_0x0166:
        if (r2 != 0) goto L_0x0247;
    L_0x0168:
        r0 = r17;
        r0.ˎ(r9, r7, r3);
        r0 = r17;
        r2 = r0.ˎ;
        r0 = r17;
        r3 = r0.ॱ;
        r4 = r9.ˋ;
        r0 = r17;
        r2.ˏ(r0, r3, r4);
    L_0x017c:
        r0 = r17;
        r2 = r0.ˎ;
        r0 = r17;
        r2.ˊ(r0);
        r4 = r17.getChildCount();
        r2 = 0;
        r3 = r2;
    L_0x018b:
        if (r3 >= r4) goto L_0x02cb;
    L_0x018d:
        r0 = r17;
        r5 = r0.getChildAt(r3);
        r2 = r5.getLayoutParams();
        r2 = (androidx.viewpager.widget.ViewPager.LayoutParams) r2;
        r2.ʼ = r3;
        r6 = r2.ˎ;
        if (r6 != 0) goto L_0x01b6;
    L_0x019f:
        r6 = r2.ˋ;
        r7 = 0;
        r6 = (r6 > r7 ? 1 : (r6 == r7 ? 0 : -1));
        if (r6 != 0) goto L_0x01b6;
    L_0x01a6:
        r0 = r17;
        r5 = r0.ˏ(r5);
        if (r5 == 0) goto L_0x01b6;
    L_0x01ae:
        r6 = r5.ˊ;
        r2.ˋ = r6;
        r5 = r5.ˎ;
        r2.ˊ = r5;
    L_0x01b6:
        r2 = r3 + 1;
        r3 = r2;
        goto L_0x018b;
    L_0x01ba:
        r2 = r4 + 1;
        r4 = r2;
        goto L_0x00ce;
    L_0x01bf:
        r2 = 0;
        goto L_0x0112;
    L_0x01c2:
        r5 = 1073741824; // 0x40000000 float:2.0 double:5.304989477E-315;
        r6 = r9.ˊ;
        r5 = r5 - r6;
        r6 = r17.getPaddingLeft();
        r6 = (float) r6;
        r14 = (float) r13;
        r6 = r6 / r14;
        r5 = r5 + r6;
        goto L_0x0119;
    L_0x01d1:
        r14 = r2.ˎ;
        if (r8 != r14) goto L_0x01fb;
    L_0x01d5:
        r14 = r2.ˏ;
        if (r14 != 0) goto L_0x01fb;
    L_0x01d9:
        r0 = r17;
        r14 = r0.ʽ;
        r14.remove(r4);
        r0 = r17;
        r14 = r0.ˎ;
        r2 = r2.ˋ;
        r0 = r17;
        r14.ˋ(r0, r8, r2);
        r4 = r4 + -1;
        r7 = r7 + -1;
        if (r4 < 0) goto L_0x01ff;
    L_0x01f1:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r4);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
    L_0x01fb:
        r8 = r8 + -1;
        goto L_0x0127;
    L_0x01ff:
        r2 = 0;
        goto L_0x01fb;
    L_0x0201:
        if (r2 == 0) goto L_0x021b;
    L_0x0203:
        r14 = r2.ˎ;
        if (r8 != r14) goto L_0x021b;
    L_0x0207:
        r2 = r2.ˊ;
        r6 = r6 + r2;
        r4 = r4 + -1;
        if (r4 < 0) goto L_0x0219;
    L_0x020e:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r4);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
        goto L_0x01fb;
    L_0x0219:
        r2 = 0;
        goto L_0x01fb;
    L_0x021b:
        r2 = r4 + 1;
        r0 = r17;
        r2 = r0.ˊ(r8, r2);
        r2 = r2.ˊ;
        r6 = r6 + r2;
        r7 = r7 + 1;
        if (r4 < 0) goto L_0x0235;
    L_0x022a:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r4);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
        goto L_0x01fb;
    L_0x0235:
        r2 = 0;
        goto L_0x01fb;
    L_0x0237:
        r6 = 0;
        goto L_0x0150;
    L_0x023a:
        r2 = r17.getPaddingRight();
        r2 = (float) r2;
        r4 = (float) r13;
        r2 = r2 / r4;
        r4 = 1073741824; // 0x40000000 float:2.0 double:5.304989477E-315;
        r2 = r2 + r4;
        r4 = r2;
        goto L_0x0154;
    L_0x0247:
        r10 = r2.ˎ;
        if (r8 != r10) goto L_0x0313;
    L_0x024b:
        r10 = r2.ˏ;
        if (r10 != 0) goto L_0x0313;
    L_0x024f:
        r0 = r17;
        r10 = r0.ʽ;
        r10.remove(r6);
        r0 = r17;
        r10 = r0.ˎ;
        r2 = r2.ˋ;
        r0 = r17;
        r10.ˋ(r0, r8, r2);
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.size();
        if (r6 >= r2) goto L_0x027f;
    L_0x026b:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r6);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
    L_0x0275:
        r15 = r5;
        r5 = r2;
        r2 = r15;
    L_0x0278:
        r8 = r8 + 1;
        r15 = r2;
        r2 = r5;
        r5 = r15;
        goto L_0x015e;
    L_0x027f:
        r2 = 0;
        goto L_0x0275;
    L_0x0281:
        if (r2 == 0) goto L_0x02a6;
    L_0x0283:
        r10 = r2.ˎ;
        if (r8 != r10) goto L_0x02a6;
    L_0x0287:
        r2 = r2.ˊ;
        r5 = r5 + r2;
        r6 = r6 + 1;
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.size();
        if (r6 >= r2) goto L_0x02a4;
    L_0x0296:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r6);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
    L_0x02a0:
        r15 = r5;
        r5 = r2;
        r2 = r15;
        goto L_0x0278;
    L_0x02a4:
        r2 = 0;
        goto L_0x02a0;
    L_0x02a6:
        r0 = r17;
        r2 = r0.ˊ(r8, r6);
        r6 = r6 + 1;
        r2 = r2.ˊ;
        r5 = r5 + r2;
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.size();
        if (r6 >= r2) goto L_0x02c9;
    L_0x02bb:
        r0 = r17;
        r2 = r0.ʽ;
        r2 = r2.get(r6);
        r2 = (androidx.viewpager.widget.ViewPager.c) r2;
    L_0x02c5:
        r15 = r5;
        r5 = r2;
        r2 = r15;
        goto L_0x0278;
    L_0x02c9:
        r2 = 0;
        goto L_0x02c5;
    L_0x02cb:
        r17.ʼ();
        r2 = r17.hasFocus();
        if (r2 == 0) goto L_0x0023;
    L_0x02d4:
        r2 = r17.findFocus();
        if (r2 == 0) goto L_0x0311;
    L_0x02da:
        r0 = r17;
        r2 = r0.ˎ(r2);
    L_0x02e0:
        if (r2 == 0) goto L_0x02ea;
    L_0x02e2:
        r2 = r2.ˎ;
        r0 = r17;
        r3 = r0.ॱ;
        if (r2 == r3) goto L_0x0023;
    L_0x02ea:
        r2 = 0;
    L_0x02eb:
        r3 = r17.getChildCount();
        if (r2 >= r3) goto L_0x0023;
    L_0x02f1:
        r0 = r17;
        r3 = r0.getChildAt(r2);
        r0 = r17;
        r4 = r0.ˏ(r3);
        if (r4 == 0) goto L_0x030e;
    L_0x02ff:
        r4 = r4.ˎ;
        r0 = r17;
        r5 = r0.ॱ;
        if (r4 != r5) goto L_0x030e;
    L_0x0307:
        r4 = 2;
        r3 = r3.requestFocus(r4);
        if (r3 != 0) goto L_0x0023;
    L_0x030e:
        r2 = r2 + 1;
        goto L_0x02eb;
    L_0x0311:
        r2 = 0;
        goto L_0x02e0;
    L_0x0313:
        r15 = r5;
        r5 = r2;
        r2 = r15;
        goto L_0x0278;
    L_0x0318:
        r9 = r2;
        goto L_0x0101;
    L_0x031b:
        r2 = r5;
        goto L_0x00f2;
    L_0x031e:
        r3 = r2;
        goto L_0x001a;
        */
        throw new UnsupportedOperationException("Method not decompiled: androidx.viewpager.widget.ViewPager.ˏ(int):void");
    }

    private void ʼ() {
        if (this.ﹳ != 0) {
            if (this.mDrawingOrderedChildren == null) {
                this.mDrawingOrderedChildren = new ArrayList();
            } else {
                this.mDrawingOrderedChildren.clear();
            }
            int childCount = getChildCount();
            for (int i = 0; i < childCount; i++) {
                this.mDrawingOrderedChildren.add(getChildAt(i));
            }
            Collections.sort(this.mDrawingOrderedChildren, sPositionComparator);
        }
    }

    private void ˎ(ItemInfo cVar, int i, ItemInfo cVar2) {
        float f;
        float f2;
        int i2;
        ItemInfo cVar3;
        int i3;
        int ˎ = this.mAdapter.getCount();
        int ᐝ = getClientWidth();
        if (ᐝ > 0) {
            f = ((float) this.ʻॱ) / ((float) ᐝ);
        } else {
            f = 0.0f;
        }
        if (cVar2 != null) {
            ᐝ = cVar2.position;
            int i4;
            if (ᐝ < cVar.position) {
                f2 = (cVar2.ॱ + cVar2.ˊ) + f;
                i4 = ᐝ + 1;
                i2 = 0;
                while (i4 <= cVar.position && i2 < this.mItems.size()) {
                    cVar3 = (ItemInfo) this.mItems.get(i2);
                    while (i4 > cVar3.position && i2 < this.mItems.size() - 1) {
                        i2++;
                        cVar3 = (ItemInfo) this.mItems.get(i2);
                    }
                    while (i4 < cVar3.position) {
                        f2 += this.mAdapter.getPageWidth(i4) + f;
                        i4++;
                    }
                    cVar3.ॱ = f2;
                    f2 += cVar3.ˊ + f;
                    i4++;
                }
            } else if (ᐝ > cVar.position) {
                i2 = this.mItems.size() - 1;
                f2 = cVar2.ॱ;
                i4 = ᐝ - 1;
                while (i4 >= cVar.position && i2 >= 0) {
                    cVar3 = (ItemInfo) this.mItems.get(i2);
                    while (i4 < cVar3.position && i2 > 0) {
                        i2--;
                        cVar3 = (ItemInfo) this.mItems.get(i2);
                    }
                    while (i4 > cVar3.position) {
                        f2 -= this.mAdapter.getPageWidth(i4) + f;
                        i4--;
                    }
                    f2 -= cVar3.ˊ + f;
                    cVar3.ॱ = f2;
                    i4--;
                }
            }
        }
        int size = this.mItems.size();
        float f3 = cVar.ॱ;
        i2 = cVar.position - 1;
        this.ॱˎ = cVar.position == 0 ? cVar.ॱ : -3.4028235E38f;
        this.ʾ = cVar.position == ˎ + -1 ? (cVar.ॱ + cVar.ˊ) - 1.0f : Float.MAX_VALUE;
        for (i3 = i - 1; i3 >= 0; i3--) {
            cVar3 = (ItemInfo) this.mItems.get(i3);
            f2 = f3;
            while (i2 > cVar3.position) {
                f2 -= this.mAdapter.getPageWidth(i2) + f;
                i2--;
            }
            f3 = f2 - (cVar3.ˊ + f);
            cVar3.ॱ = f3;
            if (cVar3.position == 0) {
                this.ॱˎ = f3;
            }
            i2--;
        }
        f3 = (cVar.ॱ + cVar.ˊ) + f;
        i2 = cVar.position + 1;
        for (i3 = i + 1; i3 < size; i3++) {
            cVar3 = (ItemInfo) this.mItems.get(i3);
            f2 = f3;
            while (i2 < cVar3.position) {
                f2 = (this.mAdapter.getPageWidth(i2) + f) + f2;
                i2++;
            }
            if (cVar3.position == ˎ - 1) {
                this.ʾ = (cVar3.ˊ + f2) - 1.0f;
            }
            cVar3.ॱ = f2;
            f3 = f2 + (cVar3.ˊ + f);
            i2++;
        }
        this.ᐝᐝ = false;
    }

    public Parcelable onSaveInstanceState() {
        Parcelable savedState = new SavedState(super.onSaveInstanceState());
        savedState.ॱ = this.mCurItem;
        if (this.mAdapter != null) {
            savedState.ˋ = this.mAdapter.saveState();
        }
        return savedState;
    }

    public void onRestoreInstanceState(Parcelable parcelable) {
        if (parcelable instanceof SavedState) {
            SavedState savedState = (SavedState) parcelable;
            super.onRestoreInstanceState(savedState.ˊ());
            if (this.mAdapter != null) {
                this.mAdapter.restoreState(savedState.ˋ, savedState.ˎ);
                setCurrentItemInternal(savedState.ॱ, false, true);
                return;
            }
            this.mRestoredCurItem = savedState.ॱ;
            this.mRestoredAdapterState = savedState.ˋ;
            this.mRestoredClassLoader = savedState.ˎ;
            return;
        }
        super.onRestoreInstanceState(parcelable);
    }

    public void addView(View view, int i, android.view.ViewGroup.LayoutParams layoutParams) {
        android.view.ViewGroup.LayoutParams layoutParams2;
        if (checkLayoutParams(layoutParams)) {
            layoutParams2 = layoutParams;
        } else {
            layoutParams2 = generateLayoutParams(layoutParams);
        }
        LayoutParams layoutParams3 = (LayoutParams) layoutParams2;
        layoutParams3.ˎ |= ॱ(view);
        if (!this.ʼॱ) {
            super.addView(view, i, layoutParams2);
        } else if (layoutParams3 == null || !layoutParams3.ˎ) {
            layoutParams3.ॱ = true;
            addViewInLayout(view, i, layoutParams2);
        } else {
            throw new IllegalStateException("Cannot add pager decor view during layout");
        }
    }

    private static boolean ॱ(@NonNull View view) {
        return view.getClass().getAnnotation(DecorView.class) != null;
    }

    public void removeView(View view) {
        if (this.ʼॱ) {
            removeViewInLayout(view);
        } else {
            super.removeView(view);
        }
    }

    ItemInfo ˏ(View view) {
        for (int i = 0; i < this.mItems.size(); i++) {
            ItemInfo cVar = (ItemInfo) this.mItems.get(i);
            if (this.mAdapter.isViewFromObject(view, cVar.object)) {
                return cVar;
            }
        }
        return null;
    }

    ItemInfo ˎ(View view) {
        while (true) {
            ViewPager parent = view.getParent();
            if (parent == this) {
                return ˏ(view);
            }
            if (parent != null && (parent instanceof View)) {
                view = parent;
            }
        }
        return null;
    }

    ItemInfo ˋ(int i) {
        for (int i2 = 0; i2 < this.mItems.size(); i2++) {
            ItemInfo cVar = (ItemInfo) this.mItems.get(i2);
            if (cVar.position == i) {
                return cVar;
            }
        }
        return null;
    }

    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
        this.mFirstLayout = true;
    }

    protected void onMeasure(int i, int i2) {
        LayoutParams layoutParams;
        int i3;
        int i4;
        setMeasuredDimension(getDefaultSize(0, i), getDefaultSize(0, i2));
        int measuredWidth = getMeasuredWidth();
        this.ˎˎ = Math.min(measuredWidth / 10, this.mDefaultGutterSize);
        int paddingLeft = (measuredWidth - getPaddingLeft()) - getPaddingRight();
        int measuredHeight = (getMeasuredHeight() - getPaddingTop()) - getPaddingBottom();
        int childCount = getChildCount();
        for (int i5 = 0; i5 < childCount; i5++) {
            View childAt = getChildAt(i5);
            if (childAt.getVisibility() != 8) {
                layoutParams = (LayoutParams) childAt.getLayoutParams();
                if (layoutParams != null && layoutParams.ˎ) {
                    int i6 = layoutParams.ˏ & 7;
                    int i7 = layoutParams.ˏ & 112;
                    i3 = Integer.MIN_VALUE;
                    i4 = Integer.MIN_VALUE;
                    Object obj = (i7 == 48 || i7 == 80) ? 1 : null;
                    Object obj2 = (i6 == 3 || i6 == 5) ? 1 : null;
                    if (obj != null) {
                        i3 = 1073741824;
                    } else if (obj2 != null) {
                        i4 = 1073741824;
                    }
                    if (layoutParams.width != -2) {
                        i7 = 1073741824;
                        i3 = layoutParams.width != -1 ? layoutParams.width : paddingLeft;
                    } else {
                        i7 = i3;
                        i3 = paddingLeft;
                    }
                    if (layoutParams.height != -2) {
                        i4 = 1073741824;
                        if (layoutParams.height != -1) {
                            measuredWidth = layoutParams.height;
                            childAt.measure(MeasureSpec.makeMeasureSpec(i3, i7), MeasureSpec.makeMeasureSpec(measuredWidth, i4));
                            if (obj != null) {
                                measuredHeight -= childAt.getMeasuredHeight();
                            } else if (obj2 != null) {
                                paddingLeft -= childAt.getMeasuredWidth();
                            }
                        }
                    }
                    measuredWidth = measuredHeight;
                    childAt.measure(MeasureSpec.makeMeasureSpec(i3, i7), MeasureSpec.makeMeasureSpec(measuredWidth, i4));
                    if (obj != null) {
                        measuredHeight -= childAt.getMeasuredHeight();
                    } else if (obj2 != null) {
                        paddingLeft -= childAt.getMeasuredWidth();
                    }
                }
            }
        }
        this.ʿ = MeasureSpec.makeMeasureSpec(paddingLeft, 1073741824);
        this.ˈ = MeasureSpec.makeMeasureSpec(measuredHeight, 1073741824);
        this.ʼॱ = true;
        populate();
        this.ʼॱ = false;
        i3 = getChildCount();
        for (i4 = 0; i4 < i3; i4++) {
            View childAt2 = getChildAt(i4);
            if (childAt2.getVisibility() != 8) {
                layoutParams = (LayoutParams) childAt2.getLayoutParams();
                if (layoutParams == null || !layoutParams.ˎ) {
                    childAt2.measure(MeasureSpec.makeMeasureSpec((int) (layoutParams.ˋ * ((float) paddingLeft)), 1073741824), this.ˈ);
                }
            }
        }
    }

    protected void onSizeChanged(int i, int i2, int i3, int i4) {
        super.onSizeChanged(i, i2, i3, i4);
        if (i != i3) {
            ˊ(i, i3, this.ʻॱ, this.ʻॱ);
        }
    }

    private void ˊ(int i, int i2, int i3, int i4) {
        if (i2 <= 0 || this.mItems.isEmpty()) {
            ItemInfo ˋ = ˋ(this.mCurItem);
            int min = (int) ((ˋ != null ? Math.min(ˋ.ॱ, this.ʾ) : 0.0f) * ((float) ((i - getPaddingLeft()) - getPaddingRight())));
            if (min != getScrollX()) {
                ˋ(false);
                scrollTo(min, getScrollY());
            }
        } else if (this.mScroller.isFinished()) {
            scrollTo((int) (((float) (((i - getPaddingLeft()) - getPaddingRight()) + i3)) * (((float) getScrollX()) / ((float) (((i2 - getPaddingLeft()) - getPaddingRight()) + i4)))), getScrollY());
        } else {
            this.mScroller.setFinalX(getCurrentItem() * getClientWidth());
        }
    }

    protected void onLayout(boolean z, int i, int i2, int i3, int i4) {
        int max;
        int childCount = getChildCount();
        int i5 = i3 - i;
        int i6 = i4 - i2;
        int paddingLeft = getPaddingLeft();
        int paddingTop = getPaddingTop();
        int paddingRight = getPaddingRight();
        int paddingBottom = getPaddingBottom();
        int scrollX = getScrollX();
        int i7 = 0;
        int i8 = 0;
        while (i8 < childCount) {
            LayoutParams layoutParams;
            int measuredWidth;
            View childAt = getChildAt(i8);
            if (childAt.getVisibility() != 8) {
                layoutParams = (LayoutParams) childAt.getLayoutParams();
                if (layoutParams.ˎ) {
                    int i9 = layoutParams.ˏ & 112;
                    switch (layoutParams.ˏ & 7) {
                        case 1:
                            max = Math.max((i5 - childAt.getMeasuredWidth()) / 2, paddingLeft);
                            break;
                        case 3:
                            max = paddingLeft;
                            paddingLeft = childAt.getMeasuredWidth() + paddingLeft;
                            break;
                        case 5:
                            measuredWidth = (i5 - paddingRight) - childAt.getMeasuredWidth();
                            paddingRight += childAt.getMeasuredWidth();
                            max = measuredWidth;
                            break;
                        default:
                            max = paddingLeft;
                            break;
                    }
                    int i10;
                    switch (i9) {
                        case 16:
                            measuredWidth = Math.max((i6 - childAt.getMeasuredHeight()) / 2, paddingTop);
                            i10 = paddingBottom;
                            paddingBottom = paddingTop;
                            paddingTop = i10;
                            break;
                        case 48:
                            measuredWidth = childAt.getMeasuredHeight() + paddingTop;
                            i10 = paddingTop;
                            paddingTop = paddingBottom;
                            paddingBottom = measuredWidth;
                            measuredWidth = i10;
                            break;
                        case 80:
                            measuredWidth = (i6 - paddingBottom) - childAt.getMeasuredHeight();
                            i10 = paddingBottom + childAt.getMeasuredHeight();
                            paddingBottom = paddingTop;
                            paddingTop = i10;
                            break;
                        default:
                            measuredWidth = paddingTop;
                            i10 = paddingBottom;
                            paddingBottom = paddingTop;
                            paddingTop = i10;
                            break;
                    }
                    max += scrollX;
                    childAt.layout(max, measuredWidth, childAt.getMeasuredWidth() + max, childAt.getMeasuredHeight() + measuredWidth);
                    measuredWidth = i7 + 1;
                    i7 = paddingBottom;
                    paddingBottom = paddingTop;
                    paddingTop = paddingRight;
                    paddingRight = paddingLeft;
                    i8++;
                    paddingLeft = paddingRight;
                    paddingRight = paddingTop;
                    paddingTop = i7;
                    i7 = measuredWidth;
                }
            }
            measuredWidth = i7;
            i7 = paddingTop;
            paddingTop = paddingRight;
            paddingRight = paddingLeft;
            i8++;
            paddingLeft = paddingRight;
            paddingRight = paddingTop;
            paddingTop = i7;
            i7 = measuredWidth;
        }
        max = (i5 - paddingLeft) - paddingRight;
        for (paddingRight = 0; paddingRight < childCount; paddingRight++) {
            View childAt2 = getChildAt(paddingRight);
            if (childAt2.getVisibility() != 8) {
                layoutParams = (LayoutParams) childAt2.getLayoutParams();
                if (!layoutParams.ˎ) {
                    ItemInfo ˏ = ˏ(childAt2);
                    if (ˏ != null) {
                        i5 = ((int) (ˏ.ॱ * ((float) max))) + paddingLeft;
                        if (layoutParams.ॱ) {
                            layoutParams.ॱ = false;
                            childAt2.measure(MeasureSpec.makeMeasureSpec((int) (layoutParams.ˋ * ((float) max)), 1073741824), MeasureSpec.makeMeasureSpec((i6 - paddingTop) - paddingBottom, 1073741824));
                        }
                        childAt2.layout(i5, paddingTop, childAt2.getMeasuredWidth() + i5, childAt2.getMeasuredHeight() + paddingTop);
                    }
                }
            }
        }
        this.ॱᐝ = paddingTop;
        this.ॱˋ = i6 - paddingBottom;
        this.ᐝˋ = i7;
        if (this.mFirstLayout) {
            ˎ(this.mCurItem, false, 0, false);
        }
        this.mFirstLayout = false;
    }

    public void computeScroll() {
        this.ͺ = true;
        if (this.mScroller.isFinished() || !this.mScroller.computeScrollOffset()) {
            ˋ(true);
            return;
        }
        int scrollX = getScrollX();
        int scrollY = getScrollY();
        int currX = this.mScroller.getCurrX();
        int currY = this.mScroller.getCurrY();
        if (!(scrollX == currX && scrollY == currY)) {
            scrollTo(currX, currY);
            if (!ॱ(currX)) {
                this.mScroller.abortAnimation();
                scrollTo(0, currY);
            }
        }
        ViewCompat.ˎ(this);
    }

    private boolean ॱ(int i) {
        if (this.mItems.size() != 0) {
            ItemInfo ॱˊ = ॱˊ();
            int ᐝ = getClientWidth();
            int i2 = this.ʻॱ + ᐝ;
            float f = ((float) this.ʻॱ) / ((float) ᐝ);
            int i3 = ॱˊ.position;
            float f2 = ((((float) i) / ((float) ᐝ)) - ॱˊ.ॱ) / (ॱˊ.ˊ + f);
            ᐝ = (int) (((float) i2) * f2);
            this.ᐝˊ = false;
            ˎ(i3, f2, ᐝ);
            if (this.ᐝˊ) {
                return true;
            }
            throw new IllegalStateException("onPageScrolled did not call superclass implementation");
        } else if (this.mFirstLayout) {
            return false;
        } else {
            this.ᐝˊ = false;
            ˎ(0, 0.0f, 0);
            if (this.ᐝˊ) {
                return false;
            }
            throw new IllegalStateException("onPageScrolled did not call superclass implementation");
        }
    }

    @CallSuper
    protected void ˎ(int i, float f, int i2) {
        int paddingLeft;
        int paddingRight;
        int i3;
        if (this.ᐝˋ > 0) {
            int scrollX = getScrollX();
            paddingLeft = getPaddingLeft();
            paddingRight = getPaddingRight();
            int width = getWidth();
            int childCount = getChildCount();
            i3 = 0;
            while (i3 < childCount) {
                int i4;
                View childAt = getChildAt(i3);
                LayoutParams layoutParams = (LayoutParams) childAt.getLayoutParams();
                if (layoutParams.ˎ) {
                    int max;
                    switch (layoutParams.ˏ & 7) {
                        case 1:
                            max = Math.max((width - childAt.getMeasuredWidth()) / 2, paddingLeft);
                            i4 = paddingRight;
                            paddingRight = paddingLeft;
                            paddingLeft = i4;
                            break;
                        case 3:
                            max = childAt.getWidth() + paddingLeft;
                            i4 = paddingLeft;
                            paddingLeft = paddingRight;
                            paddingRight = max;
                            max = i4;
                            break;
                        case 5:
                            max = (width - paddingRight) - childAt.getMeasuredWidth();
                            i4 = paddingRight + childAt.getMeasuredWidth();
                            paddingRight = paddingLeft;
                            paddingLeft = i4;
                            break;
                        default:
                            max = paddingLeft;
                            i4 = paddingRight;
                            paddingRight = paddingLeft;
                            paddingLeft = i4;
                            break;
                    }
                    max = (max + scrollX) - childAt.getLeft();
                    if (max != 0) {
                        childAt.offsetLeftAndRight(max);
                    }
                } else {
                    i4 = paddingRight;
                    paddingRight = paddingLeft;
                    paddingLeft = i4;
                }
                i3++;
                i4 = paddingLeft;
                paddingLeft = paddingRight;
                paddingRight = i4;
            }
        }
        ˊ(i, f, i2);
        if (this.mPageTransformer != null) {
            paddingRight = getScrollX();
            i3 = getChildCount();
            for (paddingLeft = 0; paddingLeft < i3; paddingLeft++) {
                View childAt2 = getChildAt(paddingLeft);
                if (!((LayoutParams) childAt2.getLayoutParams()).ˎ) {
                    this.mPageTransformer.ˊ(childAt2, ((float) (childAt2.getLeft() - paddingRight)) / ((float) getClientWidth()));
                }
            }
        }
        this.ᐝˊ = true;
    }

    private void ˊ(int i, float f, int i2) {
        if (this.ᶥ != null) {
            this.ᶥ.onPageScrolled(i, f, i2);
        }
        if (this.mOnPageChangeListeners != null) {
            int size = this.mOnPageChangeListeners.size();
            for (int i3 = 0; i3 < size; i3++) {
                OnPageChangeListener aVar = (OnPageChangeListener) this.mOnPageChangeListeners.get(i3);
                if (aVar != null) {
                    aVar.onPageScrolled(i, f, i2);
                }
            }
        }
        if (this.ㆍ != null) {
            this.ㆍ.onPageScrolled(i, f, i2);
        }
    }

    private void ॱॱ(int i) {
        if (this.ᶥ != null) {
            this.ᶥ.onPageScrollStateChanged(i);
        }
        if (this.mOnPageChangeListeners != null) {
            int size = this.mOnPageChangeListeners.size();
            for (int i2 = 0; i2 < size; i2++) {
                OnPageChangeListener aVar = (OnPageChangeListener) this.mOnPageChangeListeners.get(i2);
                if (aVar != null) {
                    aVar.onPageScrollStateChanged(i);
                }
            }
        }
        if (this.ㆍ != null) {
            this.ㆍ.onPageScrollStateChanged(i);
        }
    }

    private void dispatchOnScrollStateChanged(int i) {
        if (this.ᶥ != null) {
            this.ᶥ.onPageScrolled(i);
        }
        if (this.mOnPageChangeListeners != null) {
            int size = this.mOnPageChangeListeners.size();
            for (int i2 = 0; i2 < size; i2++) {
                OnPageChangeListener aVar = (OnPageChangeListener) this.mOnPageChangeListeners.get(i2);
                if (aVar != null) {
                    aVar.onPageScrolled(i);
                }
            }
        }
        if (this.ㆍ != null) {
            this.ㆍ.onPageScrolled(i);
        }
    }

    private void ˋ(boolean z) {
        int scrollX;
        boolean z2 = this.mScrollState == 2;
        if (z2) {
            boolean z3;
            setScrollingCacheEnabled(false);
            if (this.mScroller.isFinished()) {
                z3 = false;
            } else {
                z3 = true;
            }
            if (z3) {
                this.mScroller.abortAnimation();
                scrollX = getScrollX();
                int scrollY = getScrollY();
                int currX = this.mScroller.getCurrX();
                int currY = this.mScroller.getCurrY();
                if (!(scrollX == currX && scrollY == currY)) {
                    scrollTo(currX, currY);
                    if (currX != scrollX) {
                        ॱ(currX);
                    }
                }
            }
        }
        this.mPopulatePending = false;
        boolean z4 = z2;
        for (scrollX = 0; scrollX < this.mItems.size(); scrollX++) {
            ItemInfo cVar = (ItemInfo) this.mItems.get(scrollX);
            if (cVar.scrolling) {
                cVar.scrolling = false;
                z4 = true;
            }
        }
        if (!z4) {
            return;
        }
        if (z) {
            ViewCompat.ˏ((View) this, this.mEndScrollRunnable);
        } else {
            this.mEndScrollRunnable.run();
        }
    }

    private boolean ˊ(float f, float f2) {
        return (f < ((float) this.ˎˎ) && f2 > 0.0f) || (f > ((float) (getWidth() - this.ˎˎ)) && f2 < 0.0f);
    }

    private void enableLayers(boolean z) {
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            int i2;
            if (z) {
                i2 = this.ꜞ;
            } else {
                i2 = 0;
            }
            getChildAt(i).setLayerType(i2, null);
        }
    }

    public boolean onInterceptTouchEvent(MotionEvent motionEvent) {
        int action = motionEvent.getAction() & 255;
        if (action == 3 || action == 1) {
            ˊॱ();
            return false;
        }
        if (action != 0) {
            if (this.ˋˊ) {
                return true;
            }
            if (this.ˊᐝ) {
                return false;
            }
        }
        switch (action) {
            case 0:
                float x = motionEvent.getX();
                this.ˋˋ = x;
                this.ˌ = x;
                x = motionEvent.getY();
                this.ˑ = x;
                this.ˍ = x;
                this.ˎˏ = motionEvent.getPointerId(0);
                this.ˊᐝ = false;
                this.ͺ = true;
                this.mScroller.computeScrollOffset();
                if (this.mScrollState == 2 && Math.abs(this.mScroller.getFinalX() - this.mScroller.getCurrX()) > this.mCloseEnough) {
                    this.mScroller.abortAnimation();
                    this.mPopulatePending = false;
                    populate();
                    this.ˋˊ = true;
                    ˏ(true);
                    setScrollState(1);
                    break;
                }
                ˋ(false);
                this.ˋˊ = false;
                break;
            case 2:
                action = this.ˎˏ;
                if (action != -1) {
                    action = motionEvent.findPointerIndex(action);
                    float x2 = motionEvent.getX(action);
                    float f = x2 - this.ˌ;
                    float abs = Math.abs(f);
                    float y = motionEvent.getY(action);
                    float abs2 = Math.abs(y - this.ˑ);
                    if (f == 0.0f || ˊ(this.ˌ, f) || !ॱ(this, false, (int) f, (int) x2, (int) y)) {
                        if (abs > ((float) this.ˋᐝ) && 0.5f * abs > abs2) {
                            this.ˋˊ = true;
                            ˏ(true);
                            setScrollState(1);
                            this.ˌ = f > 0.0f ? this.ˋˋ + ((float) this.ˋᐝ) : this.ˋˋ - ((float) this.ˋᐝ);
                            this.ˍ = y;
                            setScrollingCacheEnabled(true);
                        } else if (abs2 > ((float) this.ˋᐝ)) {
                            this.ˊᐝ = true;
                        }
                        if (this.ˋˊ && ˋ(x2)) {
                            ViewCompat.ˎ(this);
                            break;
                        }
                    }
                    this.ˌ = x2;
                    this.ˍ = y;
                    this.ˊᐝ = true;
                    return false;
                }
                break;
            case 6:
                ˊ(motionEvent);
                break;
        }
        if (this.ˏˏ == null) {
            this.ˏˏ = VelocityTracker.obtain();
        }
        this.ˏˏ.addMovement(motionEvent);
        return this.ˋˊ;
    }

    public boolean onTouchEvent(MotionEvent motionEvent) {
        boolean z = false;
        if (this.ـ) {
            return true;
        }
        if (motionEvent.getAction() == 0 && motionEvent.getEdgeFlags() != 0) {
            return false;
        }
        if (this.mAdapter == null || this.mAdapter.getCount() == 0) {
            return false;
        }
        if (this.ˏˏ == null) {
            this.ˏˏ = VelocityTracker.obtain();
        }
        this.ˏˏ.addMovement(motionEvent);
        float x;
        int xVelocity;
        switch (motionEvent.getAction() & 255) {
            case 0:
                this.mScroller.abortAnimation();
                this.mPopulatePending = false;
                populate();
                x = motionEvent.getX();
                this.ˋˋ = x;
                this.ˌ = x;
                x = motionEvent.getY();
                this.ˑ = x;
                this.ˍ = x;
                this.ˎˏ = motionEvent.getPointerId(0);
                break;
            case 1:
                if (this.ˋˊ) {
                    VelocityTracker velocityTracker = this.ˏˏ;
                    velocityTracker.computeCurrentVelocity(1000, (float) this.ˏˎ);
                    xVelocity = (int) velocityTracker.getXVelocity(this.ˎˏ);
                    this.mPopulatePending = true;
                    int ᐝ = getClientWidth();
                    int scrollX = getScrollX();
                    ItemInfo ॱˊ = ॱˊ();
                    setCurrentItemInternal(ˋ(ॱˊ.position, ((((float) scrollX) / ((float) ᐝ)) - ॱˊ.ॱ) / (ॱˊ.ˊ + (((float) this.ʻॱ) / ((float) ᐝ))), xVelocity, (int) (motionEvent.getX(motionEvent.findPointerIndex(this.ˎˏ)) - this.ˋˋ)), true, true, xVelocity);
                    z = ˊॱ();
                    break;
                }
                break;
            case 2:
                if (!this.ˋˊ) {
                    xVelocity = motionEvent.findPointerIndex(this.ˎˏ);
                    if (xVelocity == -1) {
                        z = ˊॱ();
                        break;
                    }
                    float x2 = motionEvent.getX(xVelocity);
                    float abs = Math.abs(x2 - this.ˌ);
                    float y = motionEvent.getY(xVelocity);
                    x = Math.abs(y - this.ˍ);
                    if (abs > ((float) this.ˋᐝ) && abs > x) {
                        this.ˋˊ = true;
                        ˏ(true);
                        if (x2 - this.ˋˋ > 0.0f) {
                            x = this.ˋˋ + ((float) this.ˋᐝ);
                        } else {
                            x = this.ˋˋ - ((float) this.ˋᐝ);
                        }
                        this.ˌ = x;
                        this.ˍ = y;
                        setScrollState(1);
                        setScrollingCacheEnabled(true);
                        ViewParent parent = getParent();
                        if (parent != null) {
                            parent.requestDisallowInterceptTouchEvent(true);
                        }
                    }
                }
                if (this.ˋˊ) {
                    z = false | ˋ(motionEvent.getX(motionEvent.findPointerIndex(this.ˎˏ)));
                    break;
                }
                break;
            case 3:
                if (this.ˋˊ) {
                    ˎ(this.mCurItem, true, 0, false);
                    z = ˊॱ();
                    break;
                }
                break;
            case 5:
                xVelocity = motionEvent.getActionIndex();
                this.ˌ = motionEvent.getX(xVelocity);
                this.ˎˏ = motionEvent.getPointerId(xVelocity);
                break;
            case 6:
                ˊ(motionEvent);
                this.ˌ = motionEvent.getX(motionEvent.findPointerIndex(this.ˎˏ));
                break;
        }
        if (z) {
            ViewCompat.ˎ(this);
        }
        return true;
    }

    private boolean ˊॱ() {
        this.ˎˏ = -1;
        ˋॱ();
        this.mLeftEdge.onRelease();
        this.mRightEdge.onRelease();
        return this.mLeftEdge.isFinished() || this.mRightEdge.isFinished();
    }

    private void ˏ(boolean z) {
        ViewParent parent = getParent();
        if (parent != null) {
            parent.requestDisallowInterceptTouchEvent(z);
        }
    }

    private boolean ˋ(float f) {
        float f2;
        boolean z = true;
        float f3 = this.ˌ - f;
        this.ˌ = f;
        float scrollX = ((float) getScrollX()) + f3;
        int ᐝ = getClientWidth();
        float f4 = ((float) ᐝ) * this.ॱˎ;
        float f5 = ((float) ᐝ) * this.ʾ;
        ItemInfo cVar = (ItemInfo) this.mItems.get(0);
        ItemInfo cVar2 = (ItemInfo) this.mItems.get(this.mItems.size() - 1);
        if (cVar.position != 0) {
            f4 = cVar.ॱ * ((float) ᐝ);
            int i = 0;
        } else {
            boolean z2 = true;
        }
        if (cVar2.position != this.mAdapter.getCount() - 1) {
            f2 = cVar2.ॱ * ((float) ᐝ);
            int i2 = 0;
        } else {
            f2 = f5;
            boolean z3 = true;
        }
        if (scrollX < f4) {
            if (i != 0) {
                this.mLeftEdge.onPull(Math.abs(f4 - scrollX) / ((float) ᐝ));
            } else {
                z = false;
            }
        } else if (scrollX > f2) {
            if (i2 != 0) {
                this.mRightEdge.onPull(Math.abs(scrollX - f2) / ((float) ᐝ));
            } else {
                z = false;
            }
            f4 = f2;
        } else {
            f4 = scrollX;
            z = false;
        }
        this.ˌ += f4 - ((float) ((int) f4));
        scrollTo((int) f4, getScrollY());
        ॱ((int) f4);
        return z;
    }

    private ItemInfo ॱˊ() {
        float f;
        int ᐝ = getClientWidth();
        float scrollX = ᐝ > 0 ? ((float) getScrollX()) / ((float) ᐝ) : 0.0f;
        if (ᐝ > 0) {
            f = ((float) this.ʻॱ) / ((float) ᐝ);
        } else {
            f = 0.0f;
        }
        float f2 = 0.0f;
        float f3 = 0.0f;
        int i = -1;
        int i2 = 0;
        Object obj = 1;
        ItemInfo cVar = null;
        while (i2 < this.mItems.size()) {
            int i3;
            ItemInfo cVar2;
            ItemInfo cVar3 = (ItemInfo) this.mItems.get(i2);
            ItemInfo cVar4;
            if (obj != null || cVar3.position == i + 1) {
                cVar4 = cVar3;
                i3 = i2;
                cVar2 = cVar4;
            } else {
                cVar3 = this.ʻ;
                cVar3.ॱ = (f2 + f3) + f;
                cVar3.position = i + 1;
                cVar3.ˊ = this.mAdapter.getPageWidth(cVar3.position);
                cVar4 = cVar3;
                i3 = i2 - 1;
                cVar2 = cVar4;
            }
            f2 = cVar2.ॱ;
            f3 = (cVar2.ˊ + f2) + f;
            if (obj == null && scrollX < f2) {
                return cVar;
            }
            if (scrollX < f3 || i3 == this.mItems.size() - 1) {
                return cVar2;
            }
            f3 = f2;
            i = cVar2.position;
            obj = null;
            f2 = cVar2.ˊ;
            cVar = cVar2;
            i2 = i3 + 1;
        }
        return cVar;
    }

    private int ˋ(int i, float f, int i2, int i3) {
        if (Math.abs(i3) <= this.mFlingDistance || Math.abs(i2) <= this.ͺॱ) {
            i += (int) ((i >= this.mCurItem ? 0.4f : 0.6f) + f);
        } else if (i2 <= 0) {
            i++;
        }
        if (this.mItems.size() <= 0) {
            return i;
        }
        return Math.max(((ItemInfo) this.mItems.get(0)).position, Math.min(i, ((ItemInfo) this.mItems.get(this.mItems.size() - 1)).position));
    }

    public void draw(Canvas canvas) {
        super.draw(canvas);
        int i = 0;
        int overScrollMode = getOverScrollMode();
        if (overScrollMode == 0 || (overScrollMode == 1 && this.mAdapter != null && this.mAdapter.getCount() > 1)) {
            int height;
            int width;
            if (!this.mLeftEdge.isFinished()) {
                overScrollMode = canvas.save();
                height = (getHeight() - getPaddingTop()) - getPaddingBottom();
                width = getWidth();
                canvas.rotate(270.0f);
                canvas.translate((float) ((-height) + getPaddingTop()), this.ॱˎ * ((float) width));
                this.mLeftEdge.setSize(height, width);
                i = 0 | this.mLeftEdge.draw(canvas);
                canvas.restoreToCount(overScrollMode);
            }
            if (!this.mRightEdge.isFinished()) {
                overScrollMode = canvas.save();
                height = getWidth();
                width = (getHeight() - getPaddingTop()) - getPaddingBottom();
                canvas.rotate(90.0f);
                canvas.translate((float) (-getPaddingTop()), (-(this.ʾ + 1.0f)) * ((float) height));
                this.mRightEdge.setSize(width, height);
                i |= this.mRightEdge.draw(canvas);
                canvas.restoreToCount(overScrollMode);
            }
        } else {
            this.mLeftEdge.finish();
            this.mRightEdge.finish();
        }
        if (i != 0) {
            ViewCompat.ˎ(this);
        }
    }

    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);
        if (this.ʻॱ > 0 && this.ᐝॱ != null && this.mItems.size() > 0 && this.mAdapter != null) {
            int scrollX = getScrollX();
            int width = getWidth();
            float f = ((float) this.ʻॱ) / ((float) width);
            ItemInfo cVar = (ItemInfo) this.mItems.get(0);
            float f2 = cVar.ॱ;
            int size = this.mItems.size();
            int i = cVar.position;
            int i2 = ((ItemInfo) this.mItems.get(size - 1)).position;
            int i3 = 0;
            int i4 = i;
            while (i4 < i2) {
                float f3;
                while (i4 > cVar.position && i3 < size) {
                    i3++;
                    cVar = (ItemInfo) this.mItems.get(i3);
                }
                if (i4 == cVar.position) {
                    f3 = (cVar.ॱ + cVar.ˊ) * ((float) width);
                    f2 = (cVar.ॱ + cVar.ˊ) + f;
                } else {
                    float ˎ = this.mAdapter.getPageWidth(i4);
                    f3 = (f2 + ˎ) * ((float) width);
                    f2 += ˎ + f;
                }
                if (((float) this.ʻॱ) + f3 > ((float) scrollX)) {
                    this.ᐝॱ.setBounds(Math.round(f3), this.ॱᐝ, Math.round(((float) this.ʻॱ) + f3), this.ॱˋ);
                    this.ᐝॱ.draw(canvas);
                }
                if (f3 <= ((float) (scrollX + width))) {
                    i4++;
                } else {
                    return;
                }
            }
        }
    }

    private void ˊ(MotionEvent motionEvent) {
        int actionIndex = motionEvent.getActionIndex();
        if (motionEvent.getPointerId(actionIndex) == this.ˎˏ) {
            actionIndex = actionIndex == 0 ? 1 : 0;
            this.ˌ = motionEvent.getX(actionIndex);
            this.ˎˏ = motionEvent.getPointerId(actionIndex);
            if (this.ˏˏ != null) {
                this.ˏˏ.clear();
            }
        }
    }

    private void ˋॱ() {
        this.ˋˊ = false;
        this.ˊᐝ = false;
        if (this.ˏˏ != null) {
            this.ˏˏ.recycle();
            this.ˏˏ = null;
        }
    }

    private void setScrollingCacheEnabled(boolean z) {
        if (this.ʽॱ != z) {
            this.ʽॱ = z;
        }
    }

    public boolean canScrollHorizontally(int i) {
        boolean z = true;
        if (this.mAdapter == null) {
            return false;
        }
        int ᐝ = getClientWidth();
        int scrollX = getScrollX();
        if (i < 0) {
            if (scrollX <= ((int) (((float) ᐝ) * this.ॱˎ))) {
                z = false;
            }
            return z;
        } else if (i <= 0) {
            return false;
        } else {
            if (scrollX >= ((int) (((float) ᐝ) * this.ʾ))) {
                z = false;
            }
            return z;
        }
    }

    protected boolean ॱ(View view, boolean z, int i, int i2, int i3) {
        if (view instanceof ViewGroup) {
            ViewGroup viewGroup = (ViewGroup) view;
            int scrollX = view.getScrollX();
            int scrollY = view.getScrollY();
            for (int childCount = viewGroup.getChildCount() - 1; childCount >= 0; childCount--) {
                View childAt = viewGroup.getChildAt(childCount);
                if (i2 + scrollX >= childAt.getLeft() && i2 + scrollX < childAt.getRight() && i3 + scrollY >= childAt.getTop() && i3 + scrollY < childAt.getBottom()) {
                    if (ॱ(childAt, true, i, (i2 + scrollX) - childAt.getLeft(), (i3 + scrollY) - childAt.getTop())) {
                        return true;
                    }
                }
            }
        }
        if (z && view.canScrollHorizontally(-i)) {
            return true;
        }
        return false;
    }

    public boolean dispatchKeyEvent(KeyEvent keyEvent) {
        return super.dispatchKeyEvent(keyEvent) || ˋ(keyEvent);
    }

    public boolean ˋ(@NonNull KeyEvent keyEvent) {
        if (keyEvent.getAction() != 0) {
            return false;
        }
        switch (keyEvent.getKeyCode()) {
            case 21:
                if (keyEvent.hasModifiers(2)) {
                    return ʻ();
                }
                return ˎ(17);
            case 22:
                if (keyEvent.hasModifiers(2)) {
                    return ॱॱ();
                }
                return ˎ(66);
            case o.fc.c.ᵢ /*61*/:
                if (keyEvent.hasNoModifiers()) {
                    return ˎ(2);
                }
                if (keyEvent.hasModifiers(1)) {
                    return ˎ(1);
                }
                return false;
            default:
                return false;
        }
    }

    public boolean ˎ(int i) {
        View view;
        boolean ʻ;
        View findFocus = findFocus();
        if (findFocus == this) {
            view = null;
        } else {
            if (findFocus != null) {
                Object obj;
                for (ViewPager parent = findFocus.getParent(); parent instanceof ViewGroup; parent = parent.getParent()) {
                    if (parent == this) {
                        obj = 1;
                        break;
                    }
                }
                obj = null;
                if (obj == null) {
                    StringBuilder stringBuilder = new StringBuilder();
                    stringBuilder.append(findFocus.getClass().getSimpleName());
                    for (ViewParent parent2 = findFocus.getParent(); parent2 instanceof ViewGroup; parent2 = parent2.getParent()) {
                        stringBuilder.append(" => ").append(parent2.getClass().getSimpleName());
                    }
                    Log.e("ViewPager", "arrowScroll tried to find focus based on non-child current focused view " + stringBuilder.toString());
                    view = null;
                }
            }
            view = findFocus;
        }
        View findNextFocus = FocusFinder.getInstance().findNextFocus(this, view, i);
        if (findNextFocus == null || findNextFocus == view) {
            if (i == 17 || i == 1) {
                ʻ = ʻ();
            } else {
                if (i == 66 || i == 2) {
                    ʻ = ॱॱ();
                }
                ʻ = false;
            }
        } else if (i == 17) {
            ʻ = (view == null || ˏ(this.ॱॱ, findNextFocus).left < ˏ(this.ॱॱ, view).left) ? findNextFocus.requestFocus() : ʻ();
        } else {
            if (i == 66) {
                ʻ = (view == null || ˏ(this.ॱॱ, findNextFocus).left > ˏ(this.ॱॱ, view).left) ? findNextFocus.requestFocus() : ॱॱ();
            }
            ʻ = false;
        }
        if (ʻ) {
            playSoundEffect(SoundEffectConstants.getContantForFocusDirection(i));
        }
        return ʻ;
    }

    private Rect ˏ(Rect rect, View view) {
        Rect rect2;
        if (rect == null) {
            rect2 = new Rect();
        } else {
            rect2 = rect;
        }
        if (view == null) {
            rect2.set(0, 0, 0, 0);
            return rect2;
        }
        rect2.left = view.getLeft();
        rect2.right = view.getRight();
        rect2.top = view.getTop();
        rect2.bottom = view.getBottom();
        ViewPager parent = view.getParent();
        while ((parent instanceof ViewGroup) && parent != this) {
            ViewGroup viewGroup = parent;
            rect2.left += viewGroup.getLeft();
            rect2.right += viewGroup.getRight();
            rect2.top += viewGroup.getTop();
            rect2.bottom += viewGroup.getBottom();
            parent = viewGroup.getParent();
        }
        return rect2;
    }

    boolean ʻ() {
        if (this.mCurItem <= 0) {
            return false;
        }
        setCurrentItem(this.mCurItem - 1, true);
        return true;
    }

    boolean ॱॱ() {
        if (this.mAdapter == null || this.mCurItem >= this.mAdapter.getCount() - 1) {
            return false;
        }
        setCurrentItem(this.mCurItem + 1, true);
        return true;
    }

    public void addFocusables(ArrayList<View> arrayList, int i, int i2) {
        int size = arrayList.size();
        int descendantFocusability = getDescendantFocusability();
        if (descendantFocusability != 393216) {
            for (int i3 = 0; i3 < getChildCount(); i3++) {
                View childAt = getChildAt(i3);
                if (childAt.getVisibility() == 0) {
                    ItemInfo ˏ = ˏ(childAt);
                    if (ˏ != null && ˏ.position == this.mCurItem) {
                        childAt.addFocusables(arrayList, i, i2);
                    }
                }
            }
        }
        if ((descendantFocusability == 262144 && size != arrayList.size()) || !isFocusable()) {
            return;
        }
        if (((i2 & 1) != 1 || !isInTouchMode() || isFocusableInTouchMode()) && arrayList != null) {
            arrayList.add(this);
        }
    }

    public void addTouchables(ArrayList<View> arrayList) {
        for (int i = 0; i < getChildCount(); i++) {
            View childAt = getChildAt(i);
            if (childAt.getVisibility() == 0) {
                ItemInfo ˏ = ˏ(childAt);
                if (ˏ != null && ˏ.position == this.mCurItem) {
                    childAt.addTouchables(arrayList);
                }
            }
        }
    }

    protected boolean onRequestFocusInDescendants(int i, Rect rect) {
        int i2;
        int i3 = -1;
        int childCount = getChildCount();
        if ((i & 2) != 0) {
            i3 = 1;
            i2 = 0;
        } else {
            i2 = childCount - 1;
            childCount = -1;
        }
        while (i2 != childCount) {
            View childAt = getChildAt(i2);
            if (childAt.getVisibility() == 0) {
                ItemInfo ˏ = ˏ(childAt);
                if (ˏ != null && ˏ.position == this.mCurItem && childAt.requestFocus(i, rect)) {
                    return true;
                }
            }
            i2 += i3;
        }
        return false;
    }

    public boolean dispatchPopulateAccessibilityEvent(AccessibilityEvent accessibilityEvent) {
        if (accessibilityEvent.getEventType() == 4096) {
            return super.dispatchPopulateAccessibilityEvent(accessibilityEvent);
        }
        int childCount = getChildCount();
        for (int i = 0; i < childCount; i++) {
            View childAt = getChildAt(i);
            if (childAt.getVisibility() == 0) {
                ItemInfo ˏ = ˏ(childAt);
                if (ˏ != null && ˏ.position == this.mCurItem && childAt.dispatchPopulateAccessibilityEvent(accessibilityEvent)) {
                    return true;
                }
            }
        }
        return false;
    }

    protected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams() {
        return new LayoutParams();
    }

    protected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return generateDefaultLayoutParams();
    }

    protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams layoutParams) {
        return (layoutParams instanceof LayoutParams) && super.checkLayoutParams(layoutParams);
    }

    public android.view.ViewGroup.LayoutParams generateLayoutParams(AttributeSet attributeSet) {
        return new LayoutParams(getContext(), attributeSet);
    }
}
